import { createRouter, createWebHistory } from "vue-router";
// 导入导航守卫
import { beforeEach, afterEach } from "./guards";
// 总路由
import { routers } from "./router";
import { createApp } from "vue";
import loginDialogPlugin from "@plugin/loginDialogPlugin";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routers,
});

router.app = createApp();
router.app.use(loginDialogPlugin);

// 守卫
router.beforeEach(beforeEach);
router.afterEach(afterEach);

export default router;
